<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<div class="modal-dialog x-modal-dialog" style="width: 723px;">
  <div class="modal-content">

    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">
        <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
      </button>
      <h4 class="modal-title">新增赌局</h4>
    </div>

    <form class="form-horizontal x-form" method="POST" action="${ctx.host}/bets/create" data-validate="true">
      <input type="hidden" name="_method" value="POST" /> <input type="hidden" id="cover" name="mediaId" value="${bet.cover}">
      <!-- <input type="hidden" name="agentCompanyId" value="${agentCompany.id}" />-->

      <div class="modal-body">
      
        <div class="form-group  x-form-group">
          <label class="control-label col-xs-3"><span class="text-red">*</span>赌局名称：</label>
          <div class="col-xs-8">
            <input type="text" class="form-control name" name="name" data-validate="required" tabindex="5" placeholder="中文名称" autocomplete="off" /> <span class="text-red check"></span>
          </div>
        </div>

        <div class="form-group  x-form-group">
          <label class="control-label col-xs-3"><span class="text-red">*</span>活动封面：</label>
          <div class="col-xs-8">
            <div class="upload-cover" style="width: 450px; height: 270px; margin: 0 auto;">
              <button type="button" id="pickCover" class="edit-btn fade">
                <span class='glyphicon glyphicon-repeat' aria-hidden='true'></span>&nbsp;&nbsp;重新上传
              </button>
              <div id="coverPreviewList">
                <c:if test="${not empty bet.cover}">
                  <img id="coverPreview" src="${cloud.prod}/${bet.cover}-0.6" />
                </c:if>
                <c:if test="${empty bet.cover}">
                  <img id="coverPreview" src="" />
                </c:if>
              </div>
              <label id="messageCover" class="control-label messageCover hide"></label>
            </div>
          </div>
        </div>

        <div class="form-group  x-form-group" style="margin: 15px -15px 40px -15px;">
          <label class="control-label col-xs-3"><span class="text-red">*</span>有效期：</label>
          <div class="col-xs-4">
            <input type="datetime" name="startDate" class="form-control datetime" placeholder="请选择开始时间" autocomplete="off" />
          </div>
          <div class="col-xs-4">
            <input type="datetime" name="endDate" class="form-control datetime" placeholder="请选择结束时间" autocomplete="off" />
          </div>
        </div>

        <div class="modal-footer x-modal-footer">
          <button type="submit" class="btn x-btn btn-primary">确定</button>
          <button type="button" class="btn x-btn x-btn-gary" data-dismiss="modal">取消</button>
        </div>
        
      </div>
    </form>
  </div>
</div>
<script type="text/javascript">
  $(document).ready(function() {
    var now = new Date();
    now.setSeconds(0);
    $('.datetime').datetimepicker({
      format: 'yyyy-mm-dd',
      autoclose: true,
      language: 'zh-CN',
      todayBtn: 'linked',
      todayHighlight: true,
      pickerPosition: 'bottom-right',
      minView: 'hour',
      initialDate: now,
    });
  })
</script>